package com.myidis.mapper;

import com.myidis.entity.DIResult;
import com.myidis.entity.FullDIResult;
import com.myidis.entity.IndexResultList;
import com.myidis.entity.QuotaData;
import com.myidis.request.DICalculatorReq;
import com.myidis.request.SearchReq;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

public interface DIResultMapper {

    @Select("SELECT * FROM diresultslist}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "subject", column = "subject"),
            @Result(property = "calTime", column = "calTime"),
            @Result(property = "combination", column = "combination"),
            @Result(property = "springDay", column = "springDay"),
            @Result(property = "calculator", column = "calculator"),
            @Result(property = "startTime", column = "startTime"),
            @Result(property = "endTime", column = "endTime")

    })
    ArrayList<IndexResultList> list();




    @Select("SELECT * FROM diresults where listId = #{id}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "listId", column = "listId"),
            @Result(property = "time", column = "time"),
            @Result(property = "combination", column = "combination"),
            @Result(property = "LeadDI", column = "LeadDI"),
            @Result(property = "LeadMovingDI", column = "LeadMovingDI"),
            @Result(property = "LeadCummDI", column = "LeadCummDI"),
            @Result(property = "CoinDI", column = "CoinDI"),
            @Result(property = "CoinMovingDI", column = "CoinMovingDI"),
            @Result(property = "CoinCummDI", column = "CoinCummDI"),
            @Result(property = "LagDI", column = "LagDI"),
            @Result(property = "LagMovingDI", column = "LagMovingDI"),
            @Result(property = "LagCummDI", column = "LagCummDI"),
            @Result(property = "BenchmarkDI", column = "BenchmarkDI")
    })
    ArrayList<FullDIResult> getData(IndexResultList sea);

    @Select("SELECT * FROM diresultslist where id = #{id}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "subject", column = "subject"),
            @Result(property = "calTime", column = "calTime"),
            @Result(property = "combination", column = "combination"),
            @Result(property = "springDay", column = "springDay"),
            @Result(property = "calculator", column = "calculator"),
            @Result(property = "startTime", column = "startTime"),
            @Result(property = "endTime", column = "endTime")

    })
    FullDIResult getInfo(int sea);

    @Insert("INSERT intO diresults(listId, time, leadDI, LeadMovingDI, LeadCummDI, CoinDI, CoinMovingDI, " +
            "CoinCummDI, LagDI, LagMovingDI, LeadCummDI, BenchmarkDI) VALUES( #{subject}, #{time}, #{leadDI}, " +
            "#{LeadMovingDI}, #{LeadCummDI}, #{CoinDI}, #{CoinMovingDI}, #{CoinCummDI}, #{LagDI}, #{LagMovingDI}, #{LeadCummDI},#{BenchmarkDI})")
    int insertDetail(FullDIResult set);

    @Insert("INSERT intO diresultslist(id, springDay, calTime, combination, calculator, startTime, endTime) VALUES( #{id}, #{calTime}, " +
            "#{combination},#{springDay}, #{calculator}, #{startTime}, #{endTime})")
    int insertList(IndexResultList set);

    @Delete("DELETE FROM diresults WHERE listId = #{id}")
    int deleteData(int id);

    @Delete("DELETE FROM diresultslist WHERE id = #{id}")
    int delete(int id);


}
